/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ec.socialfun.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author jorge
 */
@Entity
@Table(name = "locales_imagen")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LocalesImagen.findAll", query = "SELECT l FROM LocalesImagen l"),
    @NamedQuery(name = "LocalesImagen.findByLoImCodigo", query = "SELECT l FROM LocalesImagen l WHERE l.loImCodigo = :loImCodigo"),
    @NamedQuery(name = "LocalesImagen.findByLoImDescripcion", query = "SELECT l FROM LocalesImagen l WHERE l.loImDescripcion = :loImDescripcion"),
    @NamedQuery(name = "LocalesImagen.findByLoImRutaFoto", query = "SELECT l FROM LocalesImagen l WHERE l.loImRutaFoto = :loImRutaFoto"),
    @NamedQuery(name = "LocalesImagen.recuperaPorLocalYOrden", query = "SELECT l FROM LocalesImagen l WHERE l.local = :local AND l.loImOrden = :orden"),
    @NamedQuery(name = "LocalesImagen.recuperaPorLocal", query = "SELECT l FROM LocalesImagen l WHERE l.local = :local ORDER BY l.loImOrden")})
public class LocalesImagen implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "LO_IM_CODIGO")
    private Integer loImCodigo;
    @Column(name = "LO_IM_DESCRIPCION")
    private String loImDescripcion;
    @Basic(optional = false)
    @Column(name = "LO_IM_RUTA_FOTO")
    private String loImRutaFoto;
    @Basic(optional = false)
    @Column(name = "LO_IM_ORDEN")
    private Integer loImOrden;
    @JoinColumn(name = "LO_CODIGO", referencedColumnName = "LO_CODIGO")
    @ManyToOne(optional = false)
    private Local local;

    public LocalesImagen() {
    }

    public LocalesImagen(Integer loImCodigo) {
        this.loImCodigo = loImCodigo;
    }

    public LocalesImagen(Integer loImCodigo, String loImRutaFoto) {
        this.loImCodigo = loImCodigo;
        this.loImRutaFoto = loImRutaFoto;
    }

    public Integer getLoImCodigo() {
        return loImCodigo;
    }

    public void setLoImCodigo(Integer loImCodigo) {
        this.loImCodigo = loImCodigo;
    }

    public String getLoImDescripcion() {
        return loImDescripcion;
    }

    public void setLoImDescripcion(String loImDescripcion) {
        this.loImDescripcion = loImDescripcion;
    }

    public String getLoImRutaFoto() {
        return loImRutaFoto;
    }

    public void setLoImRutaFoto(String loImRutaFoto) {
        this.loImRutaFoto = loImRutaFoto;
    }

    public Local getLocal() {
        return local;
    }

    public void setLocal(Local local) {
        this.local = local;
    }

    public Integer getLoImOrden() {
        return loImOrden;
    }

    public void setLoImOrden(Integer loImOrden) {
        this.loImOrden = loImOrden;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (loImCodigo != null ? loImCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LocalesImagen)) {
            return false;
        }
        LocalesImagen other = (LocalesImagen) object;
        if ((this.loImCodigo == null && other.loImCodigo != null) || (this.loImCodigo != null && !this.loImCodigo.equals(other.loImCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ec.socialfun.entidades.LocalesImagen[ loImCodigo=" + loImCodigo + " ]";
    }
}
